import { onMounted, onUnmounted } from "vue";

export const useAddEvent = (type: keyof WindowEventMap, fn: any) => {
  onMounted(() => {
    window.addEventListener(type, fn);
  });
};
export const useRemoveEvent = (type: keyof WindowEventMap, fn: any) => {
  onUnmounted(() => {
    window.removeEventListener(type, fn);
  });
};
